package com.bootdo.wx.service.impl;

import com.bootdo.wx.dao.GoodsTypeParamgDao;
import com.bootdo.wx.dao.GoodsTypeParamsDao;
import com.bootdo.wx.domain.GoodsTypeParamgDO;
import com.bootdo.wx.service.GoodsTypeParamgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service
public class GoodsTypeParamgServiceImpl implements GoodsTypeParamgService {
	@Autowired
	private GoodsTypeParamgDao goodsTypeParamgDao;
	@Autowired
	private GoodsTypeParamsDao goodsTypeParamsDao;
	
	@Override
	public GoodsTypeParamgDO get(String id){
		return goodsTypeParamgDao.get(id);
	}
	
	@Override
	public List<GoodsTypeParamgDO> list(Map<String, Object> map){
		return goodsTypeParamgDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return goodsTypeParamgDao.count(map);
	}
	
	@Override
	public int save(GoodsTypeParamgDO goodsTypeParamg){
		return goodsTypeParamgDao.save(goodsTypeParamg);
	}
	
	@Override
	public int update(GoodsTypeParamgDO goodsTypeParamg){
		return goodsTypeParamgDao.update(goodsTypeParamg);
	}
	
	@Override
	public int remove(String id){
		return goodsTypeParamgDao.remove(id);
	}
	
	@Override
	public int batchRemove(String[] ids){
		return goodsTypeParamgDao.batchRemove(ids);
	}

	@Override
	public List<GoodsTypeParamgDO> queryListAndValueByTypeId(String typeId) {
		List<GoodsTypeParamgDO> list = goodsTypeParamgDao.queryByTypeId(typeId);
		if (list!=null && list.size()>0){
			for (GoodsTypeParamgDO typeParamgDO:list){
				typeParamgDO.setParams(goodsTypeParamsDao.queryByTypeParamgId(typeParamgDO.getId()));
			}
		}
		return list;
	}
	
}
